/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package BeanManager;

import java.util.List;
import mapper.PhotosMapper;
import org.apache.ibatis.session.SqlSession;
import packageEntities.Photos;
import service.ConnexionBd;
import static service.ConnexionBd.session;

/**
 *
 * @author nmeli
 */
public class PhotoManager {
   public static  List<Photos> afficheParMembre(int id) {
      SqlSession unesession= ConnexionBd.getConnexion();
            PhotosMapper photo = session.getMapper(PhotosMapper.class);           
            List<Photos> mesPhoto = photo.selectByIdMembre(id);
            ConnexionBd.closeConnexion();
            return mesPhoto;
} 
   public static boolean ajout(Photos phot) {
        int nbMod = 0;
        SqlSession session = ConnexionBd.getConnexion();
        PhotosMapper mesphot = session.getMapper(PhotosMapper.class);
        nbMod = mesphot.AjoutPhoto(phot);

        session.commit();

        ConnexionBd.closeConnexion();
        return (nbMod > 0 ? true : false);
   
      }
}
